package com.sc.pattern.activeobjects;

/**
 * Created  on 2018/1/14.
 *
 * @author sc
 */
public class DisplayThread extends Thread{

    private final ActiveObject activeObject;

    public DisplayThread(String name,ActiveObject activeObject) {
        super(name);
        this.activeObject = activeObject;
    }

    @Override
    public void run() {
        for (int i=0;true;i++){
            String text =  Thread.currentThread().getName()+"->"+i;
            activeObject.displayString(text);
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
